<?php
global $mainframe, $mosConfig_live_site;
 if (IMAGE_LIGHTBOX == 'true') {
 /* 
 //revised, uncomment this and comment other should you wish to switch
$mainframe->addCustomHeadTag('<script type="text/javascript" src="' . $mainframe->getCfg('live_site') .'/components/com_oscommerce/js/prototype.js"></script>
<script type="text/javascript" src="' . $mainframe->getCfg('live_site') .'/components/com_oscommerce/js/scriptaculous.js?load=effects"></script>
<script type="text/javascript" src="' . $mainframe->getCfg('live_site') .'/components/com_oscommerce/js/lightbox.js"></script>
<link rel="stylesheet" href="' . $mainframe->getCfg('live_site') .'/components/com_oscommerce/lightbox.css" type="text/css" media="screen" />
<script src="' . $mainframe->getCfg('live_site') .'/components/com_oscommerce/includes/utility.js"></script>
<script src="' . $mainframe->getCfg('live_site') .'/components/com_oscommerce/includes/popup.js"></script>'
);

*/
//slimbox instead
$mainframe->addCustomHeadTag('<script type="text/javascript" src="' . $mosConfig_live_site .'/components/com_oscommerce/js/slimbox.js"></script>
<link rel="stylesheet" href="' . $mosConfig_live_site .'/components/com_oscommerce/slimbox.css" type="text/css" media="screen" />
<script src="' . $mosConfig_live_site .'/components/com_oscommerce/includes/utility.js"></script>
<script src="' . $mosConfig_live_site .'/components/com_oscommerce/includes/popup.js"></script>'
);
}else{

$mainframe->addCustomHeadTag('<link rel="stylesheet" href="' . $mosConfig_live_site .'/components/com_oscommerce/lightbox.css" type="text/css" media="screen" />
<script src="' . $mosConfig_live_site .'/components/com_oscommerce/includes/utility.js"></script>
<script src="' . $mosConfig_live_site .'/components/com_oscommerce/includes/popup.js"></script>'
);

}
?>

<script language="javascript"><!--
//initLightbox();
var req; 
function loadXMLDoc(key) {
   var url="<?php echo $mosConfig_live_site;?>/index2.php?option=com_oscommerce&osMod=state_dropdown&CLCid=<?php echo tep_session_id();?>&country="+key;
   getObject("states").innerHTML = '&nbsp;<img style="vertical-align:middle" src="<?php echo $mosConfig_live_site;?>/components/com_oscommerce/loading.gif">Please wait...';
   try { req = new ActiveXObject("Msxml2.XMLHTTP"); } 
   catch(e) { 
      try { req = new ActiveXObject("Microsoft.XMLHTTP"); } 
      catch(oc) { req = null; } 
   } 
   if (!req && typeof XMLHttpRequest != "undefined") { req = new XMLHttpRequest(); } 
   if (req != null) {
      req.onreadystatechange = processChange; 
      req.open("GET", url, true); 
      req.send(null); 
   } 
} 
function processChange() { 
   if (req.readyState == 4 && req.status == 200) { 
      getObject("states").innerHTML = req.responseText;
      document.create_account.state.focus();
   } 
} 
function getObject(name) { 
   var ns4 = (document.layers) ? true : false; 
   var w3c = (document.getElementById) ? true : false; 
   var ie4 = (document.all) ? true : false; 

   if (ns4) return eval('document.' + name); 
   if (w3c) return document.getElementById(name); 
   if (ie4) return eval('document.all.' + name); 
   return false; 
}
//--></script>
<?PHP
defined( 'ECJC_VALID_CONTROLLER' ) or die( 'Direct Access to this location is not allowed.' );
if (SHOW_STATUS_SCROLLER == 'true') {
?>
<SCRIPT LANGUAGE="JavaScript">
<!--
// please keep these lines on when you copy the source
// made by: Nicolas - http://www.javascript-page.com

  var x = 0
  var y = 0
  var z = 140
  var delay = 70
  var text = "<?php echo ICON_CART; ?> : <?php echo $cart->count_contents(); ?> Item(s)  <?php echo $currencies->format($cart->show_total()); ?> - <?php echo $cart->show_weight() ?>kg"
  while (y ++ < z) {
  text = " " + text
  }

  function scroller() {
  window.status = text.substring(x++, text.length);
  if (x == text.length)  {
  x = 0;
  }
  setTimeout("scroller()", delay);
  }

  scroller();
  //--> 
                  
</SCRIPT>
<?php
}
// check if the 'install' directory exists, and warn of its existence
  if (WARN_INSTALL_EXISTENCE == 'true') {
    if (file_exists(dirname($_SERVER['SCRIPT_FILENAME']) . '/install')) {
      $messageStack->add('header', WARNING_INSTALL_DIRECTORY_EXISTS, 'warning');
    }
  }

// check if the configure.php file is writeable
  if (WARN_CONFIG_WRITEABLE == 'true') {
    if ( (file_exists(dirname($_SERVER['SCRIPT_FILENAME']) . '/includes/configure.php')) && (is_writeable(dirname($_SERVER['SCRIPT_FILENAME']) . '/includes/configure.php')) ) {
      $messageStack->add('header', WARNING_CONFIG_FILE_WRITEABLE, 'warning');
    }
  }

// check if the session folder is writeable
  if (WARN_SESSION_DIRECTORY_NOT_WRITEABLE == 'true') {
    if (STORE_SESSIONS == '') {
      if (!is_dir(tep_session_save_path())) {
        $messageStack->add('header', WARNING_SESSION_DIRECTORY_NON_EXISTENT, 'warning');
      } elseif (!is_writeable(tep_session_save_path())) {
        $messageStack->add('header', WARNING_SESSION_DIRECTORY_NOT_WRITEABLE, 'warning');
      }
    }
  }

// give the visitors a message that the website will be down at ... time
  if ( (WARN_BEFORE_DOWN_FOR_MAINTENANCE == 'true') && (DOWN_FOR_MAINTENANCE == 'false') ) {
       $messageStack->add('header', TEXT_BEFORE_DOWN_FOR_MAINTENANCE . PERIOD_BEFORE_DOWN_FOR_MAINTENANCE, 'warning');
  }
// this will let the admin know that the website is DOWN FOR MAINTENANCE to the public
  if ( (DOWN_FOR_MAINTENANCE == 'true') && (EXCLUDE_ADMIN_IP_FOR_MAINTENANCE == getenv('REMOTE_ADDR')) ) {
       $messageStack->add('header', TEXT_ADMIN_DOWN_FOR_MAINTENANCE, 'warning');
  }
// check session.auto_start is disabled
  if ( (function_exists('ini_get')) && (WARN_SESSION_AUTO_START == 'true') ) {
    if (ini_get('session.auto_start') == '1') {
      $messageStack->add('header', WARNING_SESSION_AUTO_START, 'warning');
    }
  }

  if ( (WARN_DOWNLOAD_DIRECTORY_NOT_READABLE == 'true') && (DOWNLOAD_ENABLED == 'true') ) {
    if (!is_dir(DIR_FS_DOWNLOAD)) {
      $messageStack->add('header', WARNING_DOWNLOAD_DIRECTORY_NON_EXISTENT, 'warning');
    }
  }
  if ($messageStack->size('header') > 0) {
   // echo $messageStack->output('header');
    $a[messagestack] = $messageStack->output('header');
  }

// added config to switch the header bar on or off.
if (SHOW_HEADER_BAR == 'true') { 
$a['breadcrumb'] = $breadcrumb->trail(' &raquo; ');
if (USE_AS_CATALOGUE != 'true'){
?>
<?php if (tep_session_is_registered('customer_id')) { 
$a['headerlinks'] = '<a href="'.tep_href_link(FILENAME_LOGOFF, '', 'SSL').'" class="headerNavigation">'. HEADER_TITLE_LOGOFF .'</a> &nbsp;';
$a['headerlinks'] .= '|&nbsp; <a href="'. tep_href_link(FILENAME_ACCOUNT, '', 'SSL').'" class="headerNavigation">'. HEADER_TITLE_MY_ACCOUNT .'</a> &nbsp;';
$a['headerlinks'] .= '|&nbsp;';
} elseif ( $mosUser['validated'] ) {
$a['headerlinks'] .= '<a href="'. tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL') .'" class="headerNavigation">'. HEADER_TITLE_COMPLETE_CREATE_ACCOUNT .'</a> &nbsp;|&nbsp;';
} else { 
$a['headerlinks'] .= '<a href="'. tep_href_link(FILENAME_LOGIN, '', 'SSL').'" class="headerNavigation">'. HEADER_TITLE_LOGIN .'</a> &nbsp;|&nbsp;';
}
$a['headerlinks'] .= '<a href="'. tep_href_link(FILENAME_SHOPPING_CART) .'" class="headerNavigation">'. HEADER_TITLE_CART_CONTENTS .'</a> &nbsp;|&nbsp; <a href="'. tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') .'" class="headerNavigation">'. HEADER_TITLE_CHECKOUT .'</a> &nbsp;&nbsp;';
}
}
  if (isset($_REQUEST['error_message']) && tep_not_null($_REQUEST['error_message'])) {
$a['error-info'] .= htmlspecialchars(stripslashes(urldecode($_REQUEST['error_message']))); 
//htmlspecialchars(stripslashes(urldecode($HTTP_GET_VARS['error_message']))); 
  }

  if (isset($_REQUEST['info_message']) && tep_not_null($_REQUEST['info_message'])) {
$a['error-info'] .= htmlspecialchars(stripslashes(urldecode($_REQUEST['info_message']))); 
  }
  require(WS_TEMPLATES . E_TEMPLATE_FOLDER . '/header.html');
?>
